package baseTest;

public class productExceptSelf {
    public static void main(String[] args) {

    }
    public static int[] process(int[] nums){
        int len = nums.length;
        if (len == 0){
            return new int[0];
        }
        int[] ans = new int[len];
        ans[0] = 1;
        int tem = 1;
        for (int i = 1; i < len; i++) {
            ans[i] = ans[i-1] * nums[i-1];
        }
        for (int i = len -2; i >= 0 ; i--) {
            tem *= nums[i+1];
            ans[i] *= tem;
        }
        return ans;
    }
}
